aboutsummaryrefslogtreecommitdiff
path: root/src/pages/[...page].astro
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2025-06-10 17:01:27 +0300
committerValentin Popov <valentin@popov.link>2025-06-10 17:01:27 +0300
commit6a47cb4165e317721d0ebb7ff8bc33c53fa265dd (patch)
treee1d2b4930b86be3e343a4f833a338d9e14f1cd36 /src/pages/[...page].astro
parentbb7481670eedd4693f8e698261dc87243fd29448 (diff)
downloadpopov.link-6a47cb4165e317721d0ebb7ff8bc33c53fa265dd.tar.xz
popov.link-6a47cb4165e317721d0ebb7ff8bc33c53fa265dd.zip
refactor: remove Pagination component and restructure blog page
- Deleted the Pagination component as it is no longer needed. - Refactored the blog page to directly display posts without pagination. - Introduced a new index page to list all blog posts in a single view.
Diffstat (limited to 'src/pages/[...page].astro')
-rw-r--r--src/pages/[...page].astro33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/pages/[...page].astro b/src/pages/[...page].astro
deleted file mode 100644
index 6d513b2..0000000
--- a/src/pages/[...page].astro
+++ /dev/null
@@ -1,33 +0,0 @@
----
-import type { GetStaticPaths, InferGetStaticPropsType } from "astro";
-import { getCollection } from "astro:content";
-import Layout from "../layouts/BaseLayout.astro";
-import Pagination from "../components/Pagination.astro";
-import PostSummary from "../components/PostSummary.astro";
-
-type Props = InferGetStaticPropsType<typeof getStaticPaths>;
-
-export const getStaticPaths = (async ({ paginate }) => {
- const posts = await getCollection("blog", ({ data }) => {
- return data.draft !== true;
- });
-
- posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
-
- return paginate(posts, {
- pageSize: 10,
- });
-}) satisfies GetStaticPaths;
-
-const { page } = Astro.props;
----
-
-<Layout>
- <section style={{ "margin-top": "3rem" }}>
- {page.data.map((post) => <PostSummary post={post} />)}
- </section>
-
- <section>
- <Pagination nextUrl={page.url.next} prevUrl={page.url.prev} />
- </section>
-</Layout>